﻿using MediatR;
using W.Purchase.API.Application.Command.ClientCommand;
using W.Purchase.Domain;
using W.Purchase.Repository.Interface;

namespace W.Purchase.API.Application.CommandHandler.ClientCommandHandler
{
    public class UnitFindCommandHandler : IRequestHandler<UnitFindCommand, Domain.Unit>
    {
        private readonly IUnitRepository unit;
        public UnitFindCommandHandler(IUnitRepository unit)
        {
            this.unit = unit;
        }
        public async Task<Domain.Unit> Handle(UnitFindCommand request, CancellationToken cancellationToken)
        {

            var list = await unit.GetModelAsync(request.UnitId);
            return list;
        }
    }
}
